class SwitchBg {
    constructor() {
        this.bg = 'player'
    }

    call(e) {
        let bg_new = this.bg === 'player' ? 'desert' : 'player'
        e.classList.replace(this.bg, bg_new)
        this.bg = bg_new
    }
}

let sbg = new SwitchBg()
let canvas = document.querySelector('.centerDiv')
canvas.classList.add(sbg.bg)
canvas.addEventListener('click', () => sbg.call(canvas))
